package com.example.librarysysee.enums;

public enum BookStatusEnum {
    DELETE(0, "无效"),
    NORMAL(1, "可借阅"),
    FORBIDDEN(2, "不可借阅");
    private int code;
    private String desc;
    BookStatusEnum(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static BookStatusEnum getDescByCode(int code){
        switch (code){
            case 0: return BookStatusEnum.DELETE;
            case 1: return BookStatusEnum.NORMAL;
            case 2: return BookStatusEnum.FORBIDDEN;
        }
        return BookStatusEnum.DELETE;
    }
}
